import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:full_display/common/qxp_color.dart';
import 'package:full_display/common/qxp_style.dart';
import 'package:full_display/unit/asset_utils/asset_utils.dart';
import 'package:full_display/unit/screen/screen_utility.dart';

class DeviceList extends StatefulWidget {
  const DeviceList({super.key});

  @override
  State<DeviceList> createState() => _DeviceListState();
}

class _DeviceListState extends State<DeviceList> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                "本地设备列表",
                textAlign: TextAlign.center,
                style: StandardTextStyle.textWhite16BoldStyle,
              ),
              GestureDetector(
                onTap: () {},
                child: Row(
                  children: [
                    Image.asset(
                        height: 20.0.H,
                        width: 20.0.W,
                        AssetUtils.getAsset2Image("icon_noselect")),
                    Container(
                      width: 10.0.H,
                    ),
                    Text(
                      '全选',
                      textAlign: TextAlign.center,
                      style: StandardTextStyle.textWhite16BoldStyle,
                    ),
                  ],
                ),
              )
            ],
          ),
          Expanded(
            child: ListView.builder(
              scrollDirection: Axis.vertical,
              shrinkWrap: true,
              physics: BouncingScrollPhysics(),
              itemCount: 17,
              itemBuilder: (context, position) {
                return _getList(position);
              },
            ),
          )
        ],
      ),
    );
  }

  Widget _getList(int position) {
    return Container(
      margin: EdgeInsets.only(top: 10.0.H),
      padding: EdgeInsets.only(left: 20.0.H, right: 20.0.H),
      decoration: const BoxDecoration(
        color: ColorPlate.backgroundOpacity5,
        borderRadius: BorderRadius.all(Radius.circular(12.0)),
      ),
      height: 56.0.H,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            's4-b00247fcaa57',
            style: StandardTextStyle.textWhite16BoldStyle,
          ),
          Container(width: 5.0.H),
          InkWell(
            onTap: () {},
            child: Image.asset(
                height: 20.0.H,
                width: 20.0.W,
                AssetUtils.getAsset2Image("icon_item_select")),
          ),
        ],
      ),
    );
  }
}
